<?php
declare (strict_types = 1);

namespace app\tools\controller;

use app\Request;
use think\facade\View;
use watermark;

class Video
{
    public function index()
    {   
        return View::fetch();
    }


    // 视频去水印
    public function delWatermark(Request $request){
        //  var_dump($request['url']);
         $url = $request['url'];              //视频url
         $id = $request['id'];                   
         $vid = $request['vid'];                 
         $basai_id = $request['data'];    

         $api  = new \watermark\VideoSpider();      //使用extend目录下，扩展文件
         if (strpos($url,'douyin')){           //抖音
            $arr = $api->douyin($url);
        } elseif (strpos($url, 'pipix')){    //皮皮虾
            $arr = $api->pipixia($url);
        } elseif (strpos($url, 'huoshan')){     //火山
            $arr = $api->huoshan($url);
        } elseif (strpos($url, 'h5.weishi')){    //微视
            $arr = $api->weishi($url);
        } elseif (strpos($url, 'isee.weishi')){  //微视
            $arr = $api->weishi($id);
        } elseif (strpos($url, 'weibo.com')){    //微博
            $arr = $api->weibo($url);
        } elseif (strpos($url, 'oasis.weibo')){   //微博
            $arr = $api->lvzhou($url);
        } elseif (strpos($url, 'zuiyou')){       //最右
            $arr = $api->zuiyou($url);
        } elseif (strpos($url, 'bbq.bilibili')){   //B站
            $arr = $api->bbq($url);
        } elseif (strpos($url, 'kuaishou')){      //快手
            $arr = $api->kuaishou($url);
        } elseif (strpos($url, 'quanmin')){      //全民
            if(empty($vid)){
                $arr = $api->quanmin($url);
            }else{
                $arr = $api->quanmin($vid);
            }
        } elseif (strpos($url, 'moviebase')){
            $arr = $api->basai($basai_id);
        } elseif (strpos($url, 'hanyuhl')){
            $arr = $api->before($url);
        } elseif (strpos($url, 'eyepetizer')){    //开眼
            $arr = $api->kaiyan($url);
        } elseif (strpos($url, 'immomo')){      //陌陌
            $arr = $api->momo($url);
        } elseif (strpos($url, 'vuevideo')){
            $arr = $api->vuevlog($url);
        } elseif (strpos($url, 'xiaokaxiu')){
            $arr = $api->xiaokaxiu($url);
        } elseif (strpos($url, 'ippzone') || strpos($url,'pipigx') ){    //皮皮搞笑
            $arr = $api->pipigaoxiao($url);
        } elseif (strpos($url, 'qq.com')){
            $arr = $api->quanminkge($url);
        } elseif (strpos($url, 'ixigua.com')){
            $arr = $api->xigua($url);
        } elseif (strpos($url, 'doupai')){
            $arr = $api->doupai($url);
        } elseif(strpos($url,'6.cn')){
            $arr = $api->sixroom($url);
        } elseif(strpos($url,'huya.com/play/')){
            $arr = $api->huya($url);
        } elseif(strpos($url,'pearvideo.com')){
            $arr = $api->pear($url);
        } elseif(strpos($url,'xinpianchang.com')){
            $arr = $api->xinpianchang($url);
        } elseif(strpos($url,'acfun.cn')){
            $arr = $api->acfan($url);
        } elseif(strpos($url,'meipai.com')){
            $arr = $api->meipai($url);
        } else {
            $arr = array(
                'code'  => 201,
                'msg' => '不支持您输入的链接'
            );
        }
        if (!empty($arr)){
            echo json_encode($arr, JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        }
        else{
            $arr = array(
                'code' => 201,
                'msg' => '解析失败',
            );
            echo json_encode($arr, JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        }
    }

}
